package com.codesuc.aichat.chatHistory.enums;

import lombok.Getter;

/**
 * @Author: ZhangGongMing
 * @CreateTime: 2025/9/27 13:12
 * @description: 角色类型枚举
 * @Version: 1.0
 */
@Getter
public enum RoleTypeEnum {

    USER(1, "user"),
    ASSISTANT(0, "assistant");

    /**
     * 字典码
     */
    private Integer code;

    /**
     * 描述
     */
    private String desc;

    RoleTypeEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static String getByCode(Integer code) {
        for (RoleTypeEnum value : RoleTypeEnum.values()) {
            if (value.code.equals(code)) {
                return value.desc;
            }
        }
        return null;
    }

}
